import React from 'react';
import './index.css';
const defaulAvatar = require('../../../assets/image/avatar.png');

type AvatarProps = {
    src: string;
    size?: 'large' | 'small' | 'middle';
    shadow?: boolean;
}
class Avatar extends React.Component<Props & AvatarProps, State> {
    render() {
        const { src, size, shadow, className } = this.props;
        return (
            <div 
                className={`avatar ${size ? 'avatar-' + size : ''} ${shadow ? 'avatar-shadow' : ''} ${className ? className : ''}`}
                onClick={this.props.onClick}
            >
                <img 
                    className="avatar-img"
                    src={src || defaulAvatar} 
                    alt=""
                />
            </div>
        )
    }
}

export default Avatar